import { API_LIST } from '../../../Api/Api'
import { commonTableList, BuiltInData } from '../Common/common'
import { SaveExcelButton } from '../Common/options'
import { BeamType } from '../Common/Conversion'

export const BeamStatistics = async ({ url, OptionsEvent, ClientData, Permission }) => {
    const beamTypeUuid = await BeamType()
    let data = {
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`get${url}`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        options: [
            Permission.findIndex(v => v.uuid === '35501c38-286f-406d-9682-9d9987b3db8e') !== -1 && (
                <SaveExcelButton
                    key="excel"
                    title="下载报告"
                    api={API_LIST()['getBeamStatistics']}
                    data={{ IsExport: 1 }}
                />
            ),
        ],
        columns: [
            commonTableList.uuid,
            { ...commonTableList.organizationUuid, valueEnum: ClientData.organization },
            {
                dataIndex: 'bridgeName',
                title: '桥名称',
                valueType: 'input',
                rules: true,
                width: 200,
            },
            {
                dataIndex: 'beamTypeUuid',
                title: '梁类别',
                valueType: 'select',
                valueEnum: beamTypeUuid,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'part',
                title: '部位',
                valueType: 'select',
                valueEnum: BuiltInData.partText,
                rules: true,
                width: 100,
            },
            {
                dataIndex: 'beamCount',
                title: '梁片总数',
                valueType: 'inputNumber',
                rules: true,
                width: 100,
                render: e => <div>{e} 片</div>,
                hideInSearch: true,
            },
            {
                dataIndex: 'beamProduceRecordEnd',
                title: '完成数量',
                valueType: 'inputNumber',
                rules: true,
                width: 100,
                render: e => <div>{e} 片</div>,
                hideInSearch: true,
            },
            {
                dataIndex: 'beamProduceRecord',
                title: '正在加工',
                valueType: 'inputNumber',
                rules: true,
                width: 100,
                render: e => <div>{e} 片</div>,
                hideInSearch: true,
            },
            {
                dataIndex: 'unBeamProduceRecord',
                title: '未完成',
                valueType: 'inputNumber',
                rules: true,
                width: 100,
                render: e => <div>{e} 片</div>,
                hideInSearch: true,
            },
        ],
    }
    return data
}
